package com.kitty.game.gm.handler;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.equip.message.RespNotifyMiscEx;
import com.kitty.game.role.model.Role;
import com.kitty.mina.cache.DataCache;
import com.kitty.mina.message.MessagePusher;

import java.util.Collection;

public class GmJifenAll implements GMFather {

    @Override
    public boolean handle(Role aaaaa, String content) {
        int score = Integer.parseInt(content);
        if (score > 30000) {
            MessagePusher.pushMessage(aaaaa, new RespNotifyMiscEx("补偿积分不能超过三万！！"));
            return true;
        }
        Collection<Role> roles = DataCache.ONLINE_ROLES.values();
        for (Role role : roles) {
            MessagePusher.pushMessage(role, new RespNotifyMiscEx("已经收到补偿#R" + score + "积分！！"));
            SpringUtils.getRoleService().addRechargeScore(role, score);
        }
        return true;
    }
}
